<template>
  <div id="app">

 
    <van-nav-bar
  :title="$route.meta.title"
  left-text="返回"
  left-arrow
  :fixed="navfixed"
 
  @click-left="onClickLeft"
  v-if="$route.meta.isShowNav"
/>
<!-- 使用keep-alive来进行页面的缓存 -->
<div class="contentBox" v-if="$route.meta.isShowNav">
<keep-alive include="HomeIndex,ProjectIndex,DiviveIndex">
   <router-view />
</keep-alive>
</div>
<div class="contentBox" v-if="!$route.meta.isShowNav">
<keep-alive include="HomeIndex,ProjectIndex,DiviveIndex">
   <router-view />
</keep-alive>
</div>
   
      <van-tabbar route v-if="!$route.meta.isShowNav">
        <van-tabbar-item replace
                         to="/home"
                         icon="home-o">
          首页
        </van-tabbar-item>
        <van-tabbar-item replace
                         to="/project"
                         icon="diamond-o">
          专题
        </van-tabbar-item> 
        <van-tabbar-item replace
                         to="/divice"
                         icon="cluster-o">
          分类
        </van-tabbar-item>
        <van-tabbar-item replace
                         to="/shopcar"
                         icon="shopping-cart-o">
          购物车
        </van-tabbar-item>
        <van-tabbar-item replace
                         to="/mine"
                         icon="gem-o">
          我的
        </van-tabbar-item>
      </van-tabbar>
    
  </div>
</template>
<script>
export default {
  components: {

  },
  data () {
    return {
      navfixed:true,
     
    };
  },
  computed: {

  },
  created () {
      var userInfo = {
      "openId":"15978738332",
      "nickName":"赵六",
      "gender":1,
      "language":"zh_CN",
      "city":"Changping",
      "province":
      "Beijing",
      "country":"China",
      "avatarUrl":"https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTIbWFEIJj8IpGeHM7dGic1aTFZALjWcMm9ltWfFiaQfVRYticWBfgGfzXWMt2EkJWiaicPtftHAlWxUibxQ/132",
      "watermark":{"timestamp":1535513485,"appid":"wx601ce71bde7b9add"}
    };
    var openId = userInfo.openId;
    localStorage.setItem("userInfo", JSON.stringify(userInfo));
    localStorage.setItem("openId", openId);


  },
  mounted () {

  },
  methods: {
    // navbar导航点击返回
     onClickLeft() {
     this.$router.go(-1);
     console.log(111);
    },
  },
  watch:{
    "$route":function(to,from){
      console.log("去的路由",to);
      console.log("来的路由",from);
    }
  }
};
</script>
<style lang="scss" >
body{
}
#app {
 margin: 0;
 padding: 0;

  /deep/ .van-nav-bar__title,
  .van-nav-bar__text,
  .van-nav-bar .van-icon
  {
    color: #B36662;
  } 


}
</style>
